﻿@model ZoomLaCMS.Models.Exam.VM_Question
@{
    
}
@section head{
<script src="/Plugins/Ueditor/ueditor.config.js" charset="utf-8"></script>
<script src="/Plugins/Ueditor/ueditor.all.min.js" charset="utf-8"></script>
<script src="/Plugins/Ueditor/kityformula-plugin/addKityFormulaDialog.js"></script>
<script src="/Plugins/Ueditor/kityformula-plugin/getKfContent.js"></script>
<script src="/Plugins/Ueditor/kityformula-plugin/defaultFilterFix.js"></script>
@*<script src="/Plugins/Ueditor/Formdesign/leipi.Formdesign.v4.js" charset="utf-8"></script>*@
<link type="text/css" href="/dist/css/bootstrap-switch.min.css" rel="stylesheet" />
<link type="text/css" rel="stylesheet" href="/App_Themes/V3.css" />
<script src="/JS/OAKeyWord.js"></script>
<title>试题管理</title>
}
@section content{
<form action="@MVCHelper.GetAction("Question_Add",Request)" method="post">
<div id="pageflag" data-nav="edu" data-ban="ke"></div>
<div class="container margin_t5">
    <ol class="breadcrumb">
        <li><a href="@Url.Action("Default","")">用户中心</a></li>
        <li><a href="QuestList?NodeID=@Model.NodeID">试题管理</a></li>
        <li class="active">添加试题<label id="curnode_l"></label></li>
    </ol>
<div>
    <ul class="nav nav-tabs" style="border-bottom:none;">
        <li class="active"><a href="#basic" data-toggle="tab">基本信息</a></li>
        <li><a href="#question" id="questtype_a" data-toggle="tab">试题信息</a></li>
        <li><a href="#other" data-toggle="tab">解析说明</a></li>
    </ul>
    <table class="table table-striped table-bordered tab-content">
        <tbody id="basic" class="tab-pane active">
            <tr>
                <td class="td_m">试题标题:</td>
                <td>
                    <input type="text" id="txtP_title" name="txtP_title" class="form-control text_300 required" maxlength="50" value="@Model.questMod.p_title" />
                </td>
            </tr>
            <tr>
                <td>教材版本:</td>
                <td>
                    @MVCHelper.H_Radios("Version_Rad", Model.verDT, "ID", "VersionName",Model.questMod.Version.ToString())
                </td>
            </tr>
            <tr>
                <td>所属年级:</td>
                <td>
                    @MVCHelper.H_Radios("Grade_Rad", Model.gradeDT, "GradeID", "GradeName", Model.questMod.p_Views.ToString())
                </td>
            </tr>
            <tr id="nodetr" style="display:none;">
                <td class="td_l">试题类别:</td>
                <td>
                    @Html.Partial("C_TreeTlpDP",Model.treeMod)
                </td>
            </tr>
            <tr>
                <td>难度:</td>
                <td>
                    <div style="width: auto; float: left">
                        <input type="text" id="Diffcult_T" name="Diffcult_T" class="form-control text_xs float" value="@Model.questMod.p_Difficulty" />
                        <span class="rd_green">0-1之间的值,1为最易</span>
                    </div>
                </td>
            </tr>
            <tr>
                <td>题型:</td>
                <td>
                    @Model.GetQTypeRad()
                </td>
            </tr>
            <tr>
                <td>知识点:</td>
                <td>
                    <div id="Examkeyword"></div>
                    <button type="button" onclick="SelKnow()" class="btn btn-primary btn-sm">选择知识点</button>
                    <input type="hidden" id="TagKey_T" name="TagKey_T" value="@Model.questMod.Tagkey" />
                </td>
            </tr>
            <tr>
                <td>分数:</td>
                <td>p_defaultScores
                    <input type="text" id="p_defaultScores" name="p_defaultScores" class="form-control text_xs" value="@Model.questMod.p_defaultScores" />
                </td>
            </tr>
            <tr>
                <td>是否共享:</td>
                <td>
                    @Html.CheckBox("isshare_chk", Model.questMod.IsShare == 1, new { @class = "switchChk" })
                </td>
            </tr>
            <tr id="normaltr">
                <td>题干:<span class="rd_red">*</span></td>
                <td>
                    <textarea id="txtP_Content" name="txtP_Content" style="height:200px;width:100%;">@Model.questMod.p_Content</textarea>
                    @MvcHtmlString.Create(Call.GetUEditor("txtP_Content", 2))
                </td>
            </tr>
            <tr class="bigtr" style="display:none;">
                <td>试题内容</td>
                <td ng-app="app">
                    <div ng-controller="appController">
                        <table class="table table-bordered">
                            <tr><td>序号</td><td>试题名</td><td>类型</td><td>排序</td><td>操作</td></tr>
                            <tbody ng-repeat="item in list|orderBy:'-orderid'">
                                <tr>
                                    <td ng-bind="$index+1"></td>
                                    <td ng-bind="item.p_title"></td>
                                    <td>{{getTypeStr(item.p_Type)}}</td>
                                    <td>
                                        <input type="text" class="form-control int" style="width: 60px;" ng-model="item.orderid" />
                                    </td>
                                    <td>
                                        <a href="javascript:;" ng-click="remove(item.p_id);" title="移除"><span class="fa fa-remove"></span></a>
                                        <a href="javascript:;" ng-click="edit(item.p_id);" title="修改"><span class="fa fa-pencil"></span></a>
                                    </td>
                                </tr>
                            </tbody>
                        </table>
                        <button class="btn btn-primary btn-sm" type="button" onclick="ShowAdd()">添加小题</button>
                        <button class="btn btn-primary btn-sm" type="button" onclick="ShowSel()">题库引用</button>
                    </div>
                </td>
            </tr>
        </tbody>
        <tbody id="question" class="tab-pane">
            <tr>
                <td class="td_l">选项信息:</td>
                <td>
                    <span></span>
                    <select id="p_ChoseNum_DP" name="p_ChoseNum_DP" class="form-control text_x" onchange="AddOption($(this).val());">
                        <option value="0">0</option>
                        <option value="1">1</option>
                        <option value="2">2</option>
                        <option value="3">3</option>
                        <option value="4">4</option>
                        <option value="5">5</option>
                    </select>
                    <div>
                        <ul id="option_ul"></ul>
                    </div>
                </td>
            </tr>
            <tr>
                <td>正确答案：<span class="rd_green">(仅用于自动改卷)</span></td>
                <td>
                    <input type="text" id="Answer_T" name="Answer_T" class="form-control text_300" value="@Model.questMod.p_Answer" />
                    <span class="r_green_x">如有多个答案用|号分隔,用于支持自动批阅试卷,单选:A,多选:A|B,填空:值1|值2|值3</span>
                </td>
            </tr>
            <tr>
                <td>正确答案：<span class="rd_green">(教师与学生可见)</span></td>
                <td>
                    <textarea id="AnswerHtml_T" name="AnswerHtml_T" style="width:100%;height:200px;">@Model.questMod.p_shuming</textarea>
                    @MvcHtmlString.Create(Call.GetUEditor("AnswerHtml_T",2))
                </td>
            </tr>
        </tbody>
        <tbody id="other" class="tab-pane">
            <tr>
                <td class="td_m">试题解析:</td>
                <td>
                    <textarea  id="txtJiexi" name="txtJiexi" style="height: 200px; width: 100%;">
                        @if (string.IsNullOrEmpty(Model.questMod.Jiexi))
                        {
                            <p style="white-space: normal;"><span style="font-family: 宋体, sans-serif; font-size: 13px; font-weight: bold; letter-spacing: 1px; line-height: 25px; background-color: #FFFFFF;">【考点】</span></p>
                            <p style="white-space: normal;"><span style="font-family: 宋体, sans-serif; font-size: 13px; letter-spacing: 1px; line-height: 25px; background-color: #FFFFFF;"><span style="font-weight: bold;">【专题】</span></span></p>
                            <p style="white-space: normal;"><span style="font-family: 宋体, sans-serif; font-size: 13px; letter-spacing: 1px; line-height: 25px; background-color: #FFFFFF;"><span style="font-weight: bold;">【分析】</span></span></p>
                            <p style="white-space: normal;"><span style="font-family: 宋体, sans-serif; font-size: 13px; letter-spacing: 1px; line-height: 25px; background-color: #FFFFFF;"><span style="font-weight: bold;">【解答】</span></span></p>
                            <p style="white-space: normal;"><span style="font-weight: bold; font-family: 宋体, sans-serif; font-size: 13px; letter-spacing: 1px; line-height: 25px; background-color: #FFFFFF;">【点评】</span></p>
                        }
                        else
                        {
                          <div>Model.questMod.Jiexi</div>
                        }
                    </textarea>
                    @MvcHtmlString.Create(Call.GetUEditor("txtJiexi", 2))
                </td>
            </tr>
        </tbody>
        <tbody>
            <tr>
                <td colspan="2" class="text-center">
                    <input type="hidden" id="Optioninfo_Hid" name="Optioninfo_Hid" value="@Model.GetOPInfo()" />
                    <input type="submit"  class="btn btn-primary" value="保存试题"/>
                    @if(Model.Mid>0){<input type="submit" class="btn btn-primary" value="添加为新试题" />}
                    @*<button id="ebtnsubmit" class="btn btn-primary" onclick="EBtnSubmit_Click">保存试题</button>
                    <button id="savenew_btn" class="btn btn-primary" onclick="Save_New_Btn_Click">添加为新试题</button>*@
                    <a href="@Url.Action("Questlist","Exam")" class="btn btn-primary">返回列表</a>
                </td>
            </tr>
        </tbody>
    </table>
    <div style="height:50px;"></div>
</div>
</div>
<input type="hidden" id="Id_hid" value="@Model.Mid" />
<input type="hidden" ID="Qids_Hid"  name="Qids_Hid" />
<input type="hidden" ID="Qinfo_Hid" name="Qinfo_Hid" value="@Model.questMod.Qinfo"/>
</form>
}
@section script{
<style type="text/css">
#mymodal1 .modal-dialog {margin-top: 7%;}
#mymodal1 .modal-dialog iframe {height: 600px !important;}
#option_ul li {margin-top: 3px;}
#errormes {z-index: 9999;}
</style>
<script src="/dist/js/bootstrap-switch.js"></script>
<script src="/JS/DatePicker/WdatePicker.js"></script>
<script src="/JS/Controls/ZL_Dialog.js"></script>
<script src="/JS/ICMS/ZL_Exam_Paper.js"></script>
<script src="/JS/SelectCheckBox.js"></script>
<script src="/JS/jquery.validate.min.js"></script>
<script src="/JS/Controls/ZL_Array.js"></script>
<script src="/JS/Plugs/angular.min.js"></script>
<script src="/JS/ZL_Regex.js"></script>
<script src="/JS/ICMS/ZL_Exam_Controls.js"></script>
<script src="/JS/ICMS/ZL_Exam_Question.js"></script>
<script>
    $(function () {
        if ("1" == "@Model.IsSmall") { $("#bigrad").hide(); }
        if ("@Model.Mid" != "0") {
            SetRadVal('qtype_rad', "@Model.questMod.p_Type");
            $("#p_ChoseNum_DP").val("@Model.questMod.p_ChoseNum");
        }

        ZL_Regex.B_Num(".int");
        ZL_Regex.B_Float(".float");
        ZL_Regex.B_Value("#Diffcult_T", { min: 0, max: 1, });
        $("form").validate({
            rules: {
                p_title: { required: true },
                p_defaultScores: { required: true, number: true },
                p_Content: { required: true }
            },
            messages: {
                p_title: { required: "试题标题不能为空" },
                p_defaultScores: { required: "分数不能为空", number: "分数只能为数字" },
                p_Content: { required: "题干不能为空" }
            },
        });
    })
</script>
}

